<div id="maincontent">
    <div id="maincontent_inner">
        <div id="sidebar">
            <div class="menu single">
                <ul>
                    <li><a href="#">车辆故障信息库管理</a>
                        <ul>
                            <li class="current"><a href="<?php echo site_url("c=break_down&m=index"); ?>">车辆故障信息管理</a></li>
                            <li><a href="<?php echo site_url("c=break_down_category&m=index"); ?>">车辆故障类别管理</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
        <div id="content">
            <div class="title">添加车辆故障信息</div>
            <div class="infoarea">
                <form id="myform" action="<?php echo site_url("c=break_down&m=edit"); ?>" method="post">
                    <input type="hidden" name="faultid" value="<?php echo $info['faultid']; ?>">
                    <table border="0" cellspacing="0" cellpadding="0" width="100%" class="aev">
                        <tr>
                            <th>故障名称:</th>
                            <td><input type="text" class="half" name="faultname" value="<?php echo $info['faultname'] ?>"/><?php echo form_error('faultname'); ?></td>
                        </tr>
                        <tr>
                            <th>故障分类:</th>
                            <td>
                                <select name="typeid" >
                                    <?php foreach ($types as $type):  ?>
                                        <option value="<?php echo $type['typeid'] ?>" <?php
                                            if($info['typeid'] == $type['typeid']) {
                                                echo 'selected';
                                            }
                                            ?>><?php echo $type['typename'] ?></option>
                                    <?php endforeach ?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>故障表现:</th>
                            <td><textarea id="area1" class="medium full" name="faultinfo" ><?php echo $info['faultinfo'] ?></textarea><?php echo form_error('faultinfo'); ?></td>
                        </tr>
                        <tr>
                            <th>故障原因:</th>
                            <td><textarea id="area2" class="medium full" name="faultreason" ><?php echo $info['faultreason'] ?></textarea><?php echo form_error('faultreason'); ?></td>
                        </tr>
                        <tr>
                            <th>解决办法:</th>
                            <td><textarea id="area3" class="medium full" name="faultsolve" ><?php echo $info['faultsolve'] ?></textarea><?php echo form_error('faultsolve'); ?></td>
                        </tr>
                        <tr>
                            <th>关键词:</th>
                            <td><input type="text" class="half" name="faulttag" value="<?php echo $info['faulttag'] ?>" /></td>
                        </tr>
                    </table>
                    <div class="box nav" style="margin-top:5px;margin-bottom:0;">
                        &nbsp;<div style="float:right"><input type="submit" class="btn" value="确定"/><input type="button" class="btn" value="返回" onclick="gotoPage('<?php echo site_url("c=break_down&m=index"); ?>');"/></div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#myform").validate({
            rules:{
                faultname:{
                    required:true
                },
                faultinfo:{
                    required:true
                },
                faultreason:{
                    required:true
                },
                faultsolve:{
                    required:true
                }
            },
            messages:{
                faultname:{
                    required:"故障名称不能为空"
                },
                faultinfo:{
                    required:"故障表现不能为空"
                },
                faultreason:{
                    required:"故障原因不能为空"
                },
                faultsolve:{
                    required:"解决办法不能为空"
                }
            }
        });
    });

</script>
